package casino;

import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class MainMenu extends Menu {
	private BufferedImage logo = getImage("images/casino.png");
	
	public MainMenu(Casino n){
		super(n);
		init();
	}
	
	private void init(){
		elements.add(new MenuButton(this, (casino.pWidth-500)/2, (casino.pHeight-100)/2+50, 500, 100, "Find Opponent", 50, new NetworkMenu(this), "images/1.ttf"));
		elements.add(new MenuButton(this, (casino.pWidth-500)/2, (casino.pHeight-100)/2+200, 500, 100, "Achievements", 50, null,"images/1.ttf"));
		elements.add(new MenuButton(this, (casino.pWidth-500)/2, (casino.pHeight-100)/2+350, 500, 100, "Settings", 50, null,"images/1.ttf"));
	}
	
	public void draw(Graphics2D g){
		g.drawImage(casino.felt, 0, 0, casino.pWidth, casino.pHeight, casino);
		g.drawImage(logo, (casino.pWidth-800)/2, 10,casino);
		super.draw(g);
	}
	
	public void keyPress(int keycode){
		if(keycode == KeyEvent.VK_ESCAPE){
			casino.resumeGame();
		}
	}
	
	public BufferedImage getImage(String s){
		try{
			BufferedImage temp = ImageIO.read(new File(s));
			return temp;
		}catch (Exception e){
			return null;
		}
	}
}
